<!--
 * @Author: 梁志恒 1067531094@qq.com
 * @Date: 2022-09-29 19:39:34
 * @LastEditors: 梁志恒 1067531094@qq.com
 * @LastEditTime: 2022-09-30 10:52:15
 * @FilePath: \作业\demo02.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let persons = [
            {
                username: '张飞',
                sex: '男',
                salary: 50000
            },
            {
                username: '关羽',
                sex: '男',
                salary: 60000
            }
        ]
        let newPersons = []
        Object.assign(newPersons, persons)
        console.log(newPersons)
        for (let i = 0; i < newPersons.length; i++) {
            newPersons[i].salary += 2000
            console.log(newPersons[i].salary)
        }
        console.log(persons)

        let s = {
            name: "张三",
            sex: "男"
        }
        //目标对象
        let t = {};
        Object.assign(t, s)
        t.name = "lisi"
        console.log(t);
        console.log(s);
    </script>
</body>

</html>